<template>
	<div>
		菜单。。{{$store.state.UserModule.age}}<br>
		<button @click='addAge'>年龄++</button>
		<button @click='subtract'>年龄--</button>
		<button @click='getDate'>获取数据</button>
		<ul>
			<li v-for="user in userList">
				{{user.name}}||{{user.age}}
			</li>
		</ul>
		<el-table :data="userList">
			<el-table-column prop="name" label="姓名"></el-table-column>
			<el-table-column prop="age" label="年龄"></el-table-column>
		</el-table>

	</div>
</template>
<script type="text/javascript">
	export default{
		data(){
			return{
				userList:{}
			}
		},
		methods:{
			addAge(){
				this.$store.dispatch('addage')
			},
			subtract(){
				this.$store.dispatch('subtract')
			},
			getDate(){
				this.$axios.get('../../static/user.json').then(response=>{
					this.userList=response.data.userList;
				}).catch(error=>{
					console.log('发生错误了：'+error)
				})
			}

		}
	}
</script>